﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MJM.Principal;
using MJM.SPP.EntidadesNegocio;

namespace wRegPadron
{
    /// <summary>
    /// Descripción breve de ghIcono
    /// </summary>
    public class ghIcono : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/png";
            string idString = context.Request.QueryString["ID"];
            string tipo = context.Request.QueryString["tipo"];
            if (!String.IsNullOrEmpty(idString))
            {
                IconoAPPEN objIconoAPPEN = MediadorCN.GetIconoAPPCN().Obtener(Convert.ToInt32(idString), Convert.ToInt32(tipo));
                byte[] img = null;
                if (objIconoAPPEN != null)
                    img = objIconoAPPEN.ICOAPP_biARCICO;
                else
                {
                    objIconoAPPEN = MediadorCN.GetIconoAPPCN().Obtener(0, 0);
                    img = img = objIconoAPPEN.ICOAPP_biARCICO;
                }
                if (img != null)
                {
                    context.Response.BinaryWrite(img);
                }
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}